package service.User;

import org.springframework.stereotype.Service;
import pojo.User;

import javax.annotation.Resource;
import java.util.Map;

@Service("userService")
public class UserServiceImpl implements UserService {
    @Resource
    private dao.User.UserMapper userMapper;

    @Override
    public User getUser(int id) {
        return userMapper.getUser(id);
    }

    @Override
    public void reviseUser(int id, int type, String value) {
        String s="";
        switch (type){
            case 0 :s="username";break;
            case 1 :s="password";break;
            case 2 :s="telephone";break;
            case 3 :s="Email";break;
            default:s= "";break;
        };
        Map<String, String> map = Map.of(
                "Id", String.valueOf(id),
                "Type", s,
                "Value", value);
        userMapper.reviseUser(map);
    }
}
